home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12067 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  837 b 

  1. Path: noc.netcom.net!news
  2. From: Tarang Deshpande <tarang@willows.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: malloc help needed
  5. Date: Thu, 28 Mar 1996 11:38:13 -0800
  6. Organization: NETCOM Network Operations
  7. Message-ID: <315AEAA5.35E6@willows.com>
  8. References: <1996Mar28.113702.15788@leeds.ac.uk>
  9. NNTP-Posting-Host: daffy.willows.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB2 (Win95; I)
  14.  
  15. A M Casey wrote:
  16. > char *Item[20];
  17. >  char *tempcontents[50];
  18. > for(count = 0; count <=20;count++)
  19. > {
  20. > Item[count] = malloc(50);
  21. > }
  22. > for(count = 0; count <=50;count++)
  23. > {
  24. > tempcontents[count] = malloc(50);
  25. > }
  26.  
  27. First thing change your loop condition to < as opposed to <=.
  28.  
  29. This should fix your problem.  If it doesn't repost and I'll take
  30. a further look.
  31.